﻿
using CSharpLibs.Annotations;

#pragma warning disable 0169

namespace System
{
	[Builtin]
	public struct UInt16 : IUSignIntegralValue, IComparable, IComparable<UInt16>, IEquatable<UInt16>
	{
		public const ushort MaxValue = 65535;
		public const ushort MinValue = 0;

		[DummyPrimitiveField]
		private ushort ff;

		public int CompareTo(object o)
		{
			if(!(o is UInt16))
				Environment.Exit(1);

			return PrimitiveHelper.DoCompareOpIntegral(this, (UInt16)o);
		}

		public int CompareTo(UInt16 us)
		{ return PrimitiveHelper.DoCompareOpIntegral(this, us); }

		public new bool Equals(object o)
		{ return (o is UInt16) && (this == ((UInt16)o)); }

		public bool Equals(UInt16 us)
		{ return this == us; }

		public new int GetHashCode()
		{ return ((ushort)this); }

		public static ushort Parse(string sv)
		{ return (ushort)PrimitiveHelper.ParseUSignIntegral(sv); }

		public override string ToString()
		{ return PrimitiveHelper.USignIntegralToString(this); }
	}
}

#pragma warning restore 0169

